export enum AnswerStatus {
  "show" = "show",
  "hide" = "hide",
}

export enum InputStatus {
  "show" = "show",
  "hide" = "hide",
}
export enum TipStatus {
  "show" = "show",
  "hide" = "hide",
}

const answerStatus = ref<AnswerStatus>(AnswerStatus.hide);
const inputStatus = ref<InputStatus>(InputStatus.show);
const tipStatus = ref<TipStatus>(TipStatus.hide);

export function useTip() {
  const showTip = () => {
    tipStatus.value = TipStatus.show;
  };
  const hideTip = () => {
    tipStatus.value = TipStatus.hide;
  };
  const isTip = () => {
    return tipStatus.value === TipStatus.show;
  };
  const autoTip = () => {
    if (isTip()) {
      return (tipStatus.value = TipStatus.hide);
    } else {
      return (tipStatus.value = TipStatus.show);
    }
  };
  return {
    showTip,
    hideTip,
    isTip,
    autoTip,
  };
}

export function useInput() {
  const showInput = () => {
    inputStatus.value = InputStatus.show;
    answerStatus.value = AnswerStatus.hide;
    tipStatus.value = TipStatus.hide;
  };
  const hideInput = () => {
    inputStatus.value = InputStatus.hide;
  };
  const isInput = () => {
    return inputStatus.value === InputStatus.show;
  };
  return {
    showInput,
    hideInput,
    isInput,
  };
}
export function useAnswer() {
  const showAnswer = () => {
    answerStatus.value = AnswerStatus.show;
  };
  const isAnswer = () => {
    return answerStatus.value === AnswerStatus.show;
  };
  const hideAnswer = () => {
    return (answerStatus.value = AnswerStatus.hide);
  };
  const autoAnswer = () => {
    if (isAnswer()) {
      return (answerStatus.value = AnswerStatus.hide);
    } else {
      return (answerStatus.value = AnswerStatus.show);
    }
  };
  return {
    showAnswer,
    isAnswer,
    hideAnswer,
    autoAnswer,
  };
}
const sumUp = ref(false);
export function useSumUp() {
  const showSumUp = () => {
    sumUp.value = true;
  };
  const hideSumUp = () => {
    answerStatus.value = AnswerStatus.hide;
    inputStatus.value = InputStatus.show;
    tipStatus.value = TipStatus.hide;
    sumUp.value = false;
  };

  return {
    sumUp,
    showSumUp,
    hideSumUp,
  };
}
